package main

import (
	"fmt"
	"math"
)

//#link: https://leetcode-cn.com/problems/excel-sheet-column-number/
func main() {
	columnTitle := "FXSHRXW"
	fmt.Println(titleToNumber(columnTitle))
}

func titleToNumber(columnTitle string) int {
	result := 0
	sByte := []byte(columnTitle)
	bit := float64(0)
	for i := len(sByte) - 1; i >= 0; i-- {
		num := int(sByte[i] - 'A' + 1)
		result += num * int(math.Pow(26, bit))
		bit++
	}
	return result
}
